package com.example.micro.netty.server.nio.buffer;

import java.nio.ByteBuffer;

public class NIOByteBufferPutGet {

    public static void main(String[] args) {
        //创建一个Buffer
        ByteBuffer byteBuffer = ByteBuffer.allocate(64);

        //类型化方式放入数据
        byteBuffer.putInt(100);
        byteBuffer.putLong(283728);
        byteBuffer.putChar('a');
        byteBuffer.putShort((short) 11);

        byteBuffer.flip();

        System.out.println(byteBuffer.getLong());
        System.out.println(byteBuffer.getLong());
        System.out.println(byteBuffer.getChar());
        System.out.println(byteBuffer.getShort());
    }

}
